package com.rainwood.water_authority.ui.adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.rainwood.water_authority.R;
import com.rainwood.water_authority.base.MyBaseAdapter;
import com.rainwood.water_authority.http.response.IssueListBean;

/**
 * @author sxs
 * @date :2020/9/28
 * @desc: 发料适配器
 */
public final class IssueBaseAdapter extends MyBaseAdapter<IssueListBean.DataDTO> {

    public IssueBaseAdapter(@NonNull Context context) {
        super(context);
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ViewHolder();
    }

    private class ViewHolder extends MyBaseAdapter.ViewHolder{

        private final TextView mIssueIdView;
        private final TextView mRoadTeamView;

        public ViewHolder() {
            super(R.layout.item_issue);
            mIssueIdView = (TextView) findViewById(R.id.tv_issue_id);
            mRoadTeamView = (TextView) findViewById(R.id.tv_road_team);
        }

        @SuppressLint("SetTextI18n")
        @Override
        public void onBindView(int position) {
            mIssueIdView.setText(getItem(position).getNumber());
            mRoadTeamView.setText(getItem(position).getSite() + "-" + getItem(position).getTeam());
        }
    }
}
